Skip to content

feat: setup websockify - #1030

Draft
link2xt wants to merge 1 commit into
mainfrom
link2xt/websockify
Draft

feat: setup websockify#1030
link2xt wants to merge 1 commit into
mainfrom
link2xt/websockify

Conversation

@link2xt

@link2xt link2xt commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

This change makes it possible
to connect the client over WebSocket.
Running websocat wss://example.org/imap
connects to the IMAP
and running websocat wss://example.org/smtp
connects to SMTP (submission service, not port 25).

Connecting from a web client will still need a CORS policy for clients not running on the same domain,
but for non-web clients this is already usable.

This change makes it possible
to connect the client over WebSocket.
Running `websocat wss://example.org/imap`
connects to the IMAP
and running `websocat wss://example.org/smtp`
connects to SMTP (submission service, not port 25).

Connecting from a web client will still need a CORS policy
for clients not running on the same domain,
but for non-web clients this is already usable.
@link2xt

link2xt commented Jul 29, 2026

Copy link
Copy Markdown
Contributor Author

The next step is adding some support to the clients, with manual configuration for now. WebSocket can eventually phase out ALPN-based stream multiplexing, but i'm not removing it and it can coexist with websockets, there is no need to migrate existing users. Discovery of websockets, e.g. extending autoconfig XML or QR codes, is also left for the future.

@DarkCat09

Copy link
Copy Markdown
Contributor

What about listening on a unix socket?
Currently, with 443 multiplexing, we have nginx opening one more TCP connection to a local IMAPS/SMTPS port, that takes one available port.
If deploying websockify exactly as this PR currently suggests, we would take 2 extra local ports instead of 1: first when nginx does proxy_pass to websockify, and second when websockify proxies to the target.
Websockify supports listening on a UDS, we could use it instead -- which also removes the TCP overhead.

@DarkCat09

Copy link
Copy Markdown
Contributor

Also, did you measure the performance and resource usage of websockify?
I'm kind of skeptical about a web server written in Python.

@link2xt

link2xt commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

What about listening on a unix socket?

I'm using dynamicuser currently to avoid dealing with filesystem permissions. With unix socket we will need to think about how to make nginx access it, who creates the socket and where etc. Don't think using 2 ports is a problem.

Also, did you measure the performance and resource usage of websockify?
I'm kind of skeptical about a web server written in Python.

The reason i have set it up is because it is already avaliable in Debian. Don't know if it will cause problems, but it's good enough for testing. We need core implementation first that will allow to setup it manually, but even then it will not be used by a lot of people because it still needs manual configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants